#!/bin/sh
ver="9.1"
cat << EOF
This script is used to update the system src.
This is mainly due to a security issue which needs to be resolved.
EOF
echo -n "Removing old src: "
if [ -d /usr/src ]; then 
rm -rf /usr/src/*
echo "done"
else
echo "NO src dir"
fi
echo -n "Fetching src"
if [ -x /usr/local/bin/svn ]; then 
svn export --force http://svn.freebsd.org/base/releng/$ver /usr/src > /dev/null 2>&1
echo "Done: Updated src to $ver"

cat << EOF
Src code has been updated to $ver, if you aren't using the src please remove it to save space.
EOF
echo -n "Diskspace used by src: "
echo "`du -hca /usr/src | grep total`"
fi
